home *** CD-ROM | disk | FTP | other *** search
- program msdemo;
-
- uses crt,mouse;
-
- const
- EventMask = $001F; (* Specifies events to interrupt on *)
- (* See your Mouse Reference Manual *)
- BothButtons = 3;
- LeftButton = 1;
- RightButton = 2;
-
- begin
- ClrScr;
- MouseRegister(EventMask);
-
- if MousePresent <> 0 then
- begin
- GotoXY(20,10);
- WriteLn('Press right and left mouse buttons to exit');
- ShowMouse;
-
- while Buttons <> BothButtons do
- begin
- if EventFlag <> 0 then
- begin
- GotoXY(1,1);
- Write('X = ',Xcoord,
- ' Y = ',Ycoord,
- ' Offset screen address = ',MCursorAddr,' ');
- if Buttons <> 0 then
- begin
- if Buttons = RightButton then
- begin
- GotoXY(1,25);
- Write('Right button pressed')
- end
- else if Buttons = LeftButton then
- begin
- GotoXY(1,25);
- Write('Left button pressed');
- end
- end
- else
- begin
- GotoXY(1,25);
- ClrEOL
- end;
- EventFlag := 0
- end
- end;
- HideMouse;
- MouseUnregister
- end;
- ClrScr;
- end.